import { request } from "@/utils/service"
import type * as Combo from "./types/combo"
import { getToken } from "@/utils/cache/cookies"
/**ZS Boolean true 为5G号卡 ，false 为 云尚号卡 */
/** 增 */
export function createComboDataApi(data: Combo.ICreateComboRequestData, ZS: boolean) {
  return request({
    url: ZS ? "applet/package/add" : "appletys/package/add",
    method: "post",
    data
  })
}

/** 删 */
export function deleteComboDataApi(id: string, ZS: boolean) {
  return request({
    url: ZS ? "applet/package/del" : "appletys/package/del",
    method: "delete",
    params: {
      id
    }
  })
}

/** 改 */
export function updateComboDataApi(data: Combo.ICreateComboRequestData, ZS: boolean) {
  return request({
    url: ZS ? "applet/package/update" : "appletys/package/update",
    method: "put",
    data
  })
}

/** 查 */
export function getComboDataApi(params: Combo.IGetComboRequestData, ZS: boolean) {
  return request<any>({
    url: ZS ? "applet/package/query" : "appletys/package/query",
    method: "get",
    params
  })
}
/**图片上传 */
export function uploadComboImageList(data: any) {
  return request({
    url: "order/package/upload",
    method: "post",
    headers: {
      "Content-Type": "multipart/form-data",
      token: getToken()
    },
    data
  })
}

// /** 根据套餐/产品id查询详情 */
// export function getComboDetail(data: any) {
//   return request<any>({
//     url: "order/package/api/queryId",
//     method: "post",
//     headers: {
//       "Content-Type": "multipart/form-data"
//     },
//     data
//   })
// }
// 多段小程序添加
export function appletmsadd(data: any) {
  return request({
    url: "appletms/package/add",
    method: "post",
    data
  })
}
// 删除
export function appletmsdel(id: string) {
  return request({
    url: "appletms/package/del",
    method: "delete",
    params: {
      id
    }
  })
}
// 改
export function appletmsupdate(data: any) {
  return request({
    url: "appletms/package/update",
    method: "put",
    data
  })
}

//查
export function appletmsquery(params: any) {
  return request<any>({
    url: "appletms/package/query",
    method: "get",
    params
  })
}
